﻿@{
    ViewBag.Title = "ThemMoi";
    Layout = "~/Views/Shared/Admin/_AdminLayout.cshtml";
}
@model BabyToys.Models.Menu
<script src="~/ckeditor/ckeditor.js"></script>
<div id="content" class="span10">
    <div class="row-fluid sortable">
            <div class="box span12">
                <div class="box-content">
                    <div>
                        <ul class="breadcrumb">
                            <li>
                                <a href="#">Home</a> <span class="divider">/</span>
                            </li>
                            <li>
                                <a href="#">Thêm menu</a>
                            </li>
                        </ul>
                    </div>
                    @using(Html.BeginForm("Sua","AdminMenu",FormMethod.Post))
                    {
                    <div class="form-actions">
                        <input type="submit" name="luu" class="btn btn-primary" value="Lưu và đóng">
                        <a href="~/adminmenu" class="btn btn-inverse">Thoát</a>
                    </div>
                    <div class="row-fluid sortable">
                        <div class="box span12 form-horizontal" style="width: 975px;"> 
                            <br />
                            <div class="control-group">
                                <label class="control-label" for="typeahead">Tên</label>
                                <div class="controls">
                                    <input type="hidden" name="id" value="@Model.Id"/>
                                    <input type="text" name="name" value="@Model.TieuDe"/>
                                    <span class="error"></span>
                                </div>
                            </div>
                            <div class="control-group">
			    <label class="control-label" for="form-field-1">Loại menu</label>
                <div class="controls">
				     <div id="myRadioGroup">
                                        <input type="hidden" id="txtMenuType" name="type" value="@Model.type"/>
                                        <script>
                                            function DisplayValueRdb() {
                                                $("#txtMenuType").val($('input[name="MenuType"]:checked').val());
                                            }
                                        </script>
                                        @if (@Model.type == 1)
                                        {
                                        <input type="radio" name="MenuType" checked="checked" value="1" onclick="DisplayValueRdb()" />
                                        <span class="lbl">Single Page Menu</span>
                                        <input type="radio" name="MenuType" value="2" onclick="DisplayValueRdb()" />
                                        <span class="lbl">Category Menu</span>
                                        <input type="radio" name="MenuType" value="3" onclick="DisplayValueRdb()" />
                                        <span class="lbl">Menu Url</span>  
                                        }
                                         @if (@Model.type == 2)
                                         {
                                        <input type="radio" name="MenuType" value="1" onclick="DisplayValueRdb()" />
                                        <span class="lbl">Single Page Menu</span>
                                        <input type="radio" name="MenuType" value="2" checked="checked"  onclick="DisplayValueRdb()" />
                                        <span class="lbl">Category Menu</span>
                                        <input type="radio" name="MenuType" value="3" onclick="DisplayValueRdb()" />
                                        <span class="lbl">Menu Url</span>  
                                         }
                                         @if (@Model.type == 3)
                                         {
                                        <input type="radio" name="MenuType" value="1" onclick="DisplayValueRdb()" />
                                        <span class="lbl">Single Page Menu</span>
                                        <input type="radio" name="MenuType" value="2" onclick="DisplayValueRdb()" />
                                        <span class="lbl">Category Menu</span>
                                        <input type="radio" name="MenuType" value="3"checked="checked"  onclick="DisplayValueRdb()" />
                                        <span class="lbl">Menu Url</span>  
                                         }     
                                        <div id="1" class="desc">
                                            <textarea rows="5" cols="10" id="ckenoidung" name="noidung">@Model.NoiDung</textarea>
                                            <script type="text/javascript">
                                                var ckeditor2 = CKEDITOR.replace("ckenoidung")
                                                ckeditor2.config.width = 700;
                                                ckeditor2.config.height = 300;
                                            </script>
                                        </div>
                                        <div id="2" class="desc">
                                            <table>
                                                <tr>
                                                    <td><label class="control-label" for="form-field-1">Chuyên mục</label></td>
                                                    <td>@Html.DropDownList("IdDanhMuc")</td>
                                                </tr>
                                            </table>
                                        </div>
                                        <div id="3" class="desc">
                                            <table>
                                                <tr>
                                                    <td><label class="control-label" for="form-field-1">Nhập Url tĩnh</label></td>
                                                    <td><input type="text" name="url" value="@Model.link"/></td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                    <script type="text/javascript">
                                        $(document).ready(function () {
                                            $("div.desc").hide();
                                            var x = $("#txtMenuType").val();
                                            $("#" + x).show();
                                            $("input[name$='MenuType']").click(function () {
                                                var test = $(this).val();
                                                $("div.desc").hide();
                                                $("#" + test).show();
                                            });
                                        });
                                    </script>
                </div>
                			</div>
                        </div>
                    </div>
                    }
                </div>
            </div>
    </div>
</div>

